'use strict';
/*
 * 权限管理（功能 + 数据）
 * @type {*}
 */
let underscore = require('underscore');
let RestifyProxy = require('../../util/RestifyProxy');
let StringUtil = require('../../util/StringUtil');
let Constant = require('../../model/Constant');
let baseService = require('../BaseService');
const URI = {
    FUNCTION: '/users',//功能列表
    FUNCTION_TREE: '/storage/getStorageTreeList',//功能右侧树菜单
    FUNCTION_CONFIRM: '/users',//功能分配权限按钮
    DATA: '/users',//数据列表
    DATA_TREE: '/storage/getStorageTreeList',//数据右侧树菜单
    DATA_CONFIRM: '/users/{0}'//数据分配权限按钮
};

/*功能权限管理——列表*/
module.exports.functionList = function (thiz, params) {
    return baseService.get(thiz, URI.FUNCTION, params);
};
/*功能权限管理——右侧树菜单*/
module.exports.functionTree = function (thiz, params) {
    return baseService.get(thiz, URI.FUNCTION_TREE, params);
};
/*功能权限管理——分配权限按钮*/
module.exports.functionConfirm = function (thiz, userId) {
    return baseService.put(thiz, StringUtil.format(URI.FUNCTION_CONFIRM, userId));
};

/*数据权限管理——列表*/
module.exports.dataList = function (thiz, params) {
    return baseService.get(thiz, URI.DATA, params);
};
/*数据权限管理——右侧树菜单*/
module.exports.dataTree = function (thiz, params) {
    return baseService.get(thiz, URI.DATA_TREE, params);
};
/*数据权限管理——分配权限按钮*/
module.exports.dataConfirm = function (thiz, userId) {
    return baseService.put(thiz, StringUtil.format(URI.DATA_CONFIRM, userId));
};